<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="pragma" content="no-cache" />
    <script src="vue.global.prod.js"></script>
    <script src="axios.min.js"></script>
    <script src="noty.min.js"></script>
    <script src="index.js"></script>
    <link rel="stylesheet" href="noty.css" />
    <link rel="stylesheet" href="mint.css" />
    <link rel="stylesheet" href="style.css" />
    <link rel="shortcut icon" href="favicon.ico" />
    <title>填写excel路径</title>
</head>

<body>
    <header class="page-head">
        <a class="title" href="/log">Format Name</a>
        <div class="compass">
            <a href="https://gitee.com/cxh1205/FormatName/blob/master/README.md#%E4%BD%BF%E7%94%A8%E6%89%8B%E5%86%8C"
                target="_blank">使用手册</a>
        </div>
    </header>
    <table id="body">
        <tr>
            <td>
                <div class="tip">
                    请按住"shift"键，并右键点击excel文件，选择"复制为路径"或者"复制文件地址"
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <input type="text" v-model="message" placeholder="请输入excel文件路径" autofocus />
            </td>
        </tr>
        <tr>
            <td>
                <div @click="submit" class="button submit">提交</div>
            </td>
        </tr>
    </table>
    <script>
        const app = Vue.createApp({
            data() {
                return {
                    message: "",
                };
            },
            methods: {
                submit() {
                    axios
                        .post("SubmitExcelPath", {
                            path: this.message.replace(/\\/g, "/"),
                        })
                        .then((res) => {
                            if (res.data["code"] == 0) {
                                notify(res.data["msg"], "success");
                                setTimeout(() => {
                                    document.location.href = "/GetKeyWord";
                                }, 1000);
                            } else {
                                notify(res.data["msg"], "error");
                            }
                        }).catch((res) => {
                            notify("未知错误，请复制黑色窗口中最后一行的报错发给作者寻找原因", "error");
                        });
                },
            },
        });
        const vm = app.mount("#body");
    </script>
</body>

</html>